package com.examples.ry.layouts;

import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;

public class RowLayoutPackJustify {
	
	public static void main(String[] args) {
		final Display display = new Display();
		Shell shell = new Shell(display, SWT.DIALOG_TRIM);
		RowLayout layout1 = new RowLayout();
		layout1.type = SWT.VERTICAL;
		layout1.fill = true;
		layout1.spacing = 10;
		layout1.marginWidth = layout1.marginHeight = 10;
		shell.setLayout(layout1);
		Label label = new Label (shell, SWT.NONE);
		label.setText ("This is a very simple MessageBox.");
		Composite composite = new Composite (shell, SWT.NONE);
		RowLayout layout2 = new RowLayout();
		layout2.pack = false;
		layout2.justify = true;
		layout2.marginWidth = layout2.marginHeight = 0;
		composite.setLayout(layout2);
		Button okButton = new Button(composite, SWT.PUSH);
		okButton.setText("OK");
		Button cancelButton = new Button(composite, SWT.PUSH);
		cancelButton.setText("Cancel");
		composite.pack();
		shell.pack();
		shell.open();
		while (!shell.isDisposed()) {
		if (!display.readAndDispatch()) display.sleep();
		}
		display.dispose();
		}

}
